
* OPEN STATA OUTPUT FILE LOG *

log using "C:\Users\jp18390\Dropbox\DISCRIMINATION PROJECT (U.S. FEDERAL AGENCIES)\Age Discrimination Project\PAR R&R\Statistics\Age_Discrimination.MANUSCRIPT.06-02-2022.smcl" 
   
   

use "C:\Users\jp18390\Dropbox\DISCRIMINATION PROJECT (U.S. FEDERAL AGENCIES)\Age Discrimination Project\PAR R&R\Statistics\Age_Discrimination_Dataset_06-02-2022.dta", replace 



  

****  2022 PAR DATA REPLICATION [6/2/2022]: "UNDERSTANDING ORGANIZATIONAL SUSCEPTIBILITY TO AGE DISCIMINRATION WITHIN THE U.S. FEDERAL WORKFORCE" [KRAUSE & PARK] ****

 
   
   
*****************************************************************************************************************************************************************************************
*****************************************************************************************************************************************************************************************
*****************************************************************************************************************************************************************************************
*****************************************************************************************************************************************************************************************
   




*** FIGURE 1: CREATE VERTICAL BOX-WHISKER PLOTS PER YEAR THAT CAPTURES THE DISTRIBUTION OF AGE DISCIRMINATION FORMAL COMPLAINTS ACROSS U.S.FEDERAL AGENCIES **
***           ONE VERTICAL BOX-WHISKER PLOT PER YEAR IN SAMPLE -- 10 YEARS--> 10 BOX-WHISKER VERTICAL PLOTS  

graph set window fontface "Century Schoolbook"
set scheme sj, permanently
graph bar (sum) age_discrimination, over (year, label(labsize(small))) ylabel (0(500)5000, labsize (small) angle(horizon)) blabel (total, position(outside) format (%9.0gc)) ytitle("") scheme(sj)



*** TABLE 1: COMPARISON OF BETWEEN TO WITHIN VARIATION IN ANALYZING AGE DISCRIMINATION FORMAL COMPLAINTS IN U.S. FEDERAL AGENCIES ***


xtset a_id year, yearly

xtsum age_discrimination  ratio_40over_suplb  ratio_40over_nonsuplb   ratio40suplb_nonsuplb   orgjustice_sem  nonprof40over_tr_lb  prof_nonprof_ratiolb_40over ///
politicization_lb   ratio_fsup_msup ratio_minsup_nonmsup lntwf


** EVALUATE DIFFERENCES IN MEANS BETWEEN PROPORTION OF WOMEN SUPERVISORS (TO ALL SUPERVISORS) AND MINORITY SUPERVISORS (TO ALL SUPERVISORS) ***

ttest ratiofemsup_sup == ratiominsup_sup, unpaired unequal



*** OBTAIN BETWEEN-EFFECTS [AGENCY GROUP MEANS] DESCRIPTIVE STATISTICS FOR EVALUATING MARGINAL EFFECTS FOR KEY COVARIATES IN REGRESSION MODELS **

collapse age_discrimination ratio_40over_suplb  ratio_40over_nonsuplb  ratio40suplb_nonsuplb      orgjustice_sem  nonprof40over_tr_lb  ///
politicization_lb   ratio_fsup_msup ratio_minsup_nonmsup lntwf, by(a_id)


sum ratio_40over_suplb  ratio_40over_nonsuplb  ratio40suplb_nonsuplb       orgjustice_sem   nonprof40over_tr_lb   politicization_lb   ratio_fsup_msup ratio_minsup_nonmsup lntwf, detail
*
*
*
*

save "C:\Users\jp18390\Dropbox\DISCRIMINATION PROJECT (U.S. FEDERAL AGENCIES)\Age Discrimination Project\PAR R&R\Statistics\collapsedagediscrim1.06-02-2022.dta", replace 
*
*
*
use "C:\Users\jp18390\Dropbox\DISCRIMINATION PROJECT (U.S. FEDERAL AGENCIES)\Age Discrimination Project\PAR R&R\Statistics\Age_Discrimination_Dataset_06-02-2022.dta", replace 




xtset a_id year, yearly





*** TABLE 2: REGRESSION MODEL TABLE PREDICTING VARIATIONS IN AGE DISCRIMINATION FORMAL COMPLAINTS IN U.S. FEDERAL AGENCIES ***


** ratio_4054_totallb: Lower bound for the ratio of older employees (age of 40-54) to total
** ratio_55over_totallb: Lower bound for the ratio of older employees (55 or older) to total


** MODEL 1: DISAGGREGATE SUPERVISOR/SUBORDINATE RATIO MEASURES [ratio_40over_suplb; ratio_40over_nonsuplb]: ONLY RANDOM INTERCEPT MODEL SPECIFICATION WITH BE & WE ESTIMATES FOR ALL COVARIATES [SANS YEAR UNIT EFFECTS & LN(TOTAL WORKFORCE)] --- REDUCED MODEL: ONLY CONTROL COVARIATES ARE LNTEF & YEAR UNIT EFFECTS ***

xthybrid age_discrimination  ratio_40over_suplb  ratio_40over_nonsuplb   lntwf ///
yr2 yr3 yr4 yr5 yr6 yr7 yr8 yr9 yr10  ratio_55over_totallb, clusterid(a_id) vce(cluster a_id)  family(nbinomial) link(log) full ///
use(ratio_40over_suplb  ratio_40over_nonsuplb  ratio_55over_totallb) 
*
estat ic


*** COMPUTE IRR [EXPONENTIATED] MARGINAL EFFECTS BASED ON BETWEEN EFFECTS INTERDECILE CHANGES IN RESPECTIVE COVARIATES ****

lincom _b[B__ratio_40over_suplb]*0.9427874  -  _b[B__ratio_40over_suplb]*0.7818404, eform
*
lincom _b[B__ratio_40over_nonsuplb]*0.792173 - _b[B__ratio_40over_nonsuplb]*0.5602603, eform
*
*
*** COMPUTE IRR [EXPONENTIATED] MARGINAL EFFECT ABSOLUTE DIFFERENCE [BASED ON INTERDECILE CHANGES] BETWEEN THESE RESPECTIVE COVARIATES ON THE INCIDENCE OF AGE DISCRIMINATION FORMAL COMPLAINTS  ****

testnl  abs(_b[B__ratio_40over_suplb]*0.9427874  -  _b[B__ratio_40over_suplb]*0.7818404) = abs(_b[B__ratio_40over_nonsuplb]*0.792173 - _b[B__ratio_40over_nonsuplb]*0.5602603)

*

*
*
*
*

** MODEL 2: DISAGGREGATE SUPERVISOR/SUBORDINATE RATIO MEASURES [ratio_40over_suplb; ratio_40over_nonsuplb]: ONLY RANDOM INTERCEPT MODEL SPECIFICATION WITH BE & WE ESTIMATES FOR ALL COVARIATES [SANS YEAR UNIT EFFECTS & LN(TOTAL WORKFORCE)] --- FULL MODEL: ALL CONTROL COVARIATES ARE LNTEF & YEAR UNIT EFFECTS ***

xthybrid age_discrimination  ratio_40over_suplb  ratio_40over_nonsuplb   orgjustice_sem   nonprof40over_tr_lb   politicization_lb ratio_fsup_msup ratio_minsup_nonmsup lntwf ///
yr2 yr3 yr4 yr5 yr6 yr7 yr8 yr9 yr10  ratio_55over_totallb, clusterid(a_id) vce(cluster a_id)  family(nbinomial) link(log) full ///
use(ratio_40over_suplb  ratio_40over_nonsuplb    orgjustice_sem  nonprof40over_tr_lb   politicization_lb   ratio_fsup_msup ratio_minsup_nonmsup ratio_55over_totallb) 
*
estat ic


*** COMPUTE IRR [EXPONENTIATED] MARGINAL EFFECTS BASED ON BETWEEN EFFECTS INTERDECILE CHANGES IN RESPECTIVE COVARIATES ****

lincom _b[B__ratio_40over_suplb]*0.9427874  - _b[B__ratio_40over_suplb]*0.7818404, eform
*
lincom _b[B__ratio_40over_nonsuplb]*0.792173 - _b[B__ratio_40over_nonsuplb]*0.5602603, eform
*
*
*
*** COMPUTE IRR [EXPONENTIATED] MARGINAL EFFECT ABSOLUTE DIFFERENCE [BASED ON INTERDECILE CHANGES] BETWEEN THESE RESPECTIVE COVARIATES ON THE INCIDENCE OF AGE DISCRIMINATION FORMAL COMPLAINTS  ****

testnl  abs(_b[B__ratio_40over_suplb]*0.9427874  -  _b[B__ratio_40over_suplb]*0.7818404) = abs(_b[B__ratio_40over_nonsuplb]*0.792173 - _b[B__ratio_40over_nonsuplb]*0.5602603)
*
*
*
*
*** COMPUTE IRR [EXPONENTIATED] MARGINAL EFFECT FOR ORGANIZATIONAL JUSTICE  BASED ON BETWEEN INTERDECILE CHANGE IN COVARIATE **

lincom _b[B__orgjustice_sem]*0.2659021 - _b[B__orgjustice_sem]*-0.1089841, eform
*
*
*





** MODEL 3: RATIO OF OVER40 SUPERVISORS TO OVER40 NON-SUPERVISORS [RATIO OF ratio_40over_suplb TO ratio_40over_nonsuplb]: ONLY RANDOM INTERCEPT MODEL SPECIFICATION WITH BE & WE ESTIMATES FOR ALL COVARIATES [SANS YEAR UNIT EFFECTS & LN(TOTAL WORKFORCE)] REDUCED MODEL: ONLY CONTROL COVARIATES ARE LNTEF & YEAR UNIT EFFECTS ***

xthybrid age_discrimination  ratio40suplb_nonsuplb   lntwf ///
yr2 yr3 yr4 yr5 yr6 yr7 yr8 yr9 yr10 ratio_55over_totallb , clusterid(a_id) vce(cluster a_id)  family(nbinomial) link(log) full ///
use(ratio40suplb_nonsuplb ratio_55over_totallb) 
*
estat ic


*** COMPUTE IRR [EXPONENTIATED] MARGINAL EFFECTS BASED ON BETWEEN EFFECTS INTERDECILE CHANGES IN RESPECTIVE COVARIATES ****

lincom _b[B__ratio40suplb_nonsuplb]*1.474348 - _b[B__ratio40suplb_nonsuplb]*1.124221, eform
*
*
*
*
*


** MODEL 4: RATIO OF OVER40 SUPERVISORS TO OVER40 NON-SUPERVISORS [RATIO OF ratio_40over_suplb TO ratio_40over_nonsuplb]: ONLY RANDOM INTERCEPT MODEL SPECIFICATION WITH BE & WE ESTIMATES FOR ALL COVARIATES [SANS YEAR UNIT EFFECTS & LN(TOTAL WORKFORCE)] --- FULL MODEL: ALL CONTROL COVARIATES ARE LNTEF & YEAR UNIT EFFECTS ***

xthybrid age_discrimination  ratio40suplb_nonsuplb    orgjustice_sem    nonprof40over_tr_lb     politicization_lb ratio_fsup_msup ratio_minsup_nonmsup lntwf ///
yr2 yr3 yr4 yr5 yr6 yr7 yr8 yr9 yr10  ratio_55over_totallb , clusterid(a_id) vce(cluster a_id)  family(nbinomial) link(log) full ///
use(ratio40suplb_nonsuplb   orgjustice_sem  nonprof40over_tr_lb    politicization_lb   ratio_fsup_msup ratio_minsup_nonmsup ratio_55over_totallb) 
*
estat ic


*** COMPUTE IRR [EXPONENTIATED] MARGINAL EFFECTS BASED ON BETWEEN EFFECTS INTERDECILE CHANGES IN RESPECTIVE COVARIATES ****

lincom _b[B__ratio40suplb_nonsuplb]*1.474348 - _b[B__ratio40suplb_nonsuplb]*1.124221, eform
*
*


** COMPUTE IRR [EXPONENTIATED] MARGINAL EFFECT FOR PROCEDURAL FAIRNESS BASED ON BETWEEN INTERDECILE CHANGE IN COVARIATE **

lincom _b[B__orgjustice_sem]*0.2659021 - _b[B__orgjustice_sem]*-0.1089841, eform
*
*
*

save "C:\Users\jp18390\Dropbox\DISCRIMINATION PROJECT (U.S. FEDERAL AGENCIES)\Age Discrimination Project\PAR R&R\Statistics\Age_Discrimination.Post-Estimation.06-02-2022.dta", replace 


*** JUNGYEON: FIGURE 2: COMPOSE VERTICAL GRAPH DISPLAYING POINT ESTIMATES AND CORRESPONDING 95% CI FOR THE ABOVE LINCOMS FROM MODELS 1 & 2 ESTIMATES ///
***                     [MODELS 2 & 4 ESTIMATES: 1/1/1] ***
clear

import excel "C:\Users\jp18390\Dropbox\DISCRIMINATION PROJECT (U.S. FEDERAL AGENCIES)\Age Discrimination Project\PAR R&R\Statistics\figure2.xlsx", sheet("Sheet1") firstrow
destring, replace
graph set window fontface "Century Schoolbook"
set scheme sj, permanently
twoway (rcap low95 high95 row, vert) (scatter estimates row if group ==1, mlabel(estimates))(scatter estimates row if group ==2, mlabel(estimates)), legend(row(1) order(2 "Reduced Model" 3 "Full Model") pos(6) size(small)) ylabel(-0.5(.25)2, labsize (small) angle(horizon)) xtitle("% of 'Older' Supervisors(H1)        % of 'Older' Non-Supervisors(H2)        Relative Balance", size(small)) xlabel("", noticks) yline(0, lpattern(dash) lcolor(gs8)) aspect(.5) 



log close
